package com.twobears.postconstruct;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class SimpleExampleBean implements InitializingBean {
    private static final Logger LOGGER = LoggerFactory.getLogger(SimpleExampleBean.class);

    // @Bean(initMethod = "initAgain")
    // public SimpleExampleBean simpleExampleBean(){
    //     return new SimpleExampleBean();
    // }
    @PostConstruct
    public void init(){
        LOGGER.debug("Bean初始化完成，调用...........");
    }

    @Override
    public void afterPropertiesSet()  {
        LOGGER.debug("Bean初始化完成，调用...........");
    }

    public void initAgain(){
        LOGGER.debug("Bean初始化完成，调用...........");
    }
}
